package com.yiyong.myabtis_genetion.config;


import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 代码生成相关陪孩子
 */
@Component
@ConfigurationProperties(prefix = "generatorcode")
@PropertySource(value = {"classpath:generatorcode.yml"})
public class GenCodeConfig {

    /**
     * 作者
     */
    public   static String author;
    /**
     * 默认生成包路径 system 需改成自己的模块名称
     */
    public static String packageName;
    /**
     * 自动去除表前缀,默认是false
     */
    public static Boolean autoRemovePre;
    /**
     * 表前缀（生成类名不会包含表前缀，多个用逗号分隔）
     */
    public static String tablePrefix;

    public static String getAuthor() {
        return author;
    }
    @Value("${author}")
    public  void setAuthor(String author) {
        GenCodeConfig.author = author;
    }

    public static String getPackageName() {
        return packageName;
    }
    @Value("${packageName}")
    public  void setPackageName(String packageName) {
        GenCodeConfig.packageName = packageName;
    }
    @Value("${autoRemovePre}")
    public  void setAutoRemovePre(Boolean autoRemovePre) {
        GenCodeConfig.autoRemovePre = autoRemovePre;
    }

    public static Boolean getAutoRemovePre() {
        return autoRemovePre;
    }

    public static String getTablePrefix() {
        return tablePrefix;
    }
    @Value("${tablePrefix}")
    public  void setTablePrefix(String tablePrefix) {
        GenCodeConfig.tablePrefix = tablePrefix;
    }
}
